<?php


namespace app\admin\logic\v1;
use app\admin\facade\UserModel;

class User extends Common
{
    /**
     * 添加用户
     * @Author:libin
     * @Time:2021/11/9 18:17
     */
    public function add()
    {
        $data['name'] = 'libin22';
        $data['account'] = 'abc22';
        $data['password'] = '1234561111111111111111111';
        $data['email'] = '12322111111111111111@qq.com';
        $user_id = UserModel::insert($data);
        halt(111);
        $a = [1,3,4,5,3,9,3,6,3,2,2];
        $result = $this->quickSort($a);
        halt($result);
    }

    public function quickSort(array $array)
    {
        if(count($array) < 2){
            return $array;
        }
        $pivot = array_pop($array);
        $left = $right = [];
        foreach ($array as $item){
            if($item < $pivot){
                $left[] = $item;
            }else{
                $right[] = $item;
            }
        }
        return array_merge($this->quickSort($left),[$pivot],$this->quickSort($right));
    }
}